<html>
<head><meta charset="utf-8"><title>Using rmeta from `--emit=metadata` · t-compiler/wg-pipelining · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/index.html">t-compiler/wg-pipelining</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/Using.20rmeta.20from.20.60--emit.3Dmetadata.60.html">Using rmeta from `--emit=metadata`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="225277825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/Using%20rmeta%20from%20%60--emit%3Dmetadata%60/near/225277825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Marcel Hlopko <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/Using.20rmeta.20from.20.60--emit.3Dmetadata.60.html#225277825">(Feb 05 2021 at 09:43)</a>:</h4>
<p>Hi folks,<br>
I'm looking into supporting pipelined compilation in Bazel's rules_rust. There it'd be a big challenge to implement the approach cargo is taking (signalling that metadata are produced and continuing with the link). So instead I'd like to invoke rustc twice, once for metadata files, and once for link.</p>
<p>AFAIU rmeta files produced only by --emit=metadata cannot be used for downstream compilations, they are only used for cargo check. If I want to use rmeta files for compilations, I have to at least run --emit=metadata,mir. At least my test crate builds fine with mir. So:</p>
<p>1) is it enough in all cases to emit mir? Or I should conservatively emit link?<br>
2) would it be possible to make --emit=metadata usable for compilations? In my test crate  emitting mir already slows down the rustc invocation to the point it doesn't make sense. I'm asking about theoretical possibilities at this point, but would it be a welcomed contribution if I attempted to make it work?</p>
<p>Thank you and have a lovely day :)</p>



<a name="225278710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/Using%20rmeta%20from%20%60--emit%3Dmetadata%60/near/225278710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/Using.20rmeta.20from.20.60--emit.3Dmetadata.60.html#225278710">(Feb 05 2021 at 09:53)</a>:</h4>
<blockquote>
<p>is it enough in all cases to emit mir? Or I should conservatively emit link?.</p>
</blockquote>
<p>I think this just happens to work, but isn't guaranteed.</p>
<blockquote>
<p>would it be possible to make --emit=metadata usable for compilations? In my test crate emitting mir already slows down the rustc invocation to the point it doesn't make sense. I'm asking about theoretical possibilities at this point, but would it be a welcomed contribution if I attempted to make it work?</p>
</blockquote>
<p>The MIR is not encoded in the metadata when using just <code>--emit=metadata</code> to make <code>cargo check</code> faster.</p>



<a name="225281412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/Using%20rmeta%20from%20%60--emit%3Dmetadata%60/near/225281412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Marcel Hlopko <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/Using.20rmeta.20from.20.60--emit.3Dmetadata.60.html#225281412">(Feb 05 2021 at 10:21)</a>:</h4>
<p>I see, and we need MIR for downstream compilations. If we're only interested in getting rmeta files for compilations, and we ignore that it's not guaranteed to work, is there some work that --emit=metadata,mir does but could be skipped? Obviously writing the MIR file is one such thing. Is there anything else?</p>



<a name="226746082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/Using%20rmeta%20from%20%60--emit%3Dmetadata%60/near/226746082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/Using.20rmeta.20from.20.60--emit.3Dmetadata.60.html#226746082">(Feb 17 2021 at 23:52)</a>:</h4>
<p>I don't think there's anything else. I think an option to emit mir in metadata should work for this use case.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>